﻿#!/usr/bin/env python
# -*- coding:utf-8 -*-

'debug method introduction'

__author__='zhaoxp'

'''
1 print
2 assert
3 logging
4 pdb
'''

import logging

if __name__=='__main__':
	print 'debug method example'
	print 'method 1 print'
	print 'method 2 assert'
	n=1
	assert n!=0,'1 n is zero'
	n=0
	#assert n!=0,'2 n is zero'
	# python -O xxx.py to ignore assert
	
	print 'method 3 logging'
	# CRITICAL > ERROR > WARNING > INFO > DEBUG > NOTSET
	s='0'
	n=int(s)
	print 'start logging'
	logging.info('n = %d' % n)
	print 'logging once'
	logging.basicConfig(level=logging.INFO)
	logging.info('n = %d' % n)
	#print 10/n
	logging.warning('warning....')
	print 'logging.